<%--
    Document   : client
    Created on : 26 mai 2012, 11:54:24
    Author     : Thomas
--%>

<%@page import="java.util.HashMap" %>

<%@include file="_header.jsp" %>
<%@include file="_left.jsp" %>

<%! String error_msg; %>
<% error_msg = (String)request.getAttribute("error_msg"); %>

<%! Customer customer; %>
<% customer=(Customer) request.getSession().getAttribute("customer"); %>

<%! HashMap<String, Boolean> errorMap; %>
<% errorMap = (HashMap<String, Boolean>)request.getAttribute("errorMap"); %>

<div class="span7">
<% if (error_msg != null) { %>
    <h3>Oups !</h3>
    <br/>
    <div class="alert-error"><strong><%= error_msg %></strong></div>
    <hr/>
    <div class="row-fluid">
        <div class="pull-right">
            <a class="btn btn-primary" href="<%= request.getContextPath() %>">OK</a>
        </div>
    </div>
<% } else { %>
    <h3>Ma commande : client (&eacute;tape 1/5)</h3>
    <br/>
    <p>
        <em>Merci de nous fournir les coordonn&eacute;es auxquelles nous pourrons vous contacter lors du traitement de votre commande.</em>
    </p>
    <br/>
    <form class="form-horizontal" method="post" action="<%= request.getContextPath() %>/Order?action=editerClient">
        <% if (errorMap != null && errorMap.get("firstName") != null && errorMap.get("firstName") == false) { %>
        <div class="control-group error">
            <label class="control-label" for="firstname">Pr&eacute;nom</label>
            <div class="controls">
                <input type="text" class="span3" name="firstname" <% if(customer.getFirstName() != null) { %> value="<%= customer.getFirstName() %>" <% } %> placeholder="Enter your firstname..." />
                <span class="help-inline"><i class="icon-exclamation-sign"></i></span>
                <span class="help-block">Le pr&eacute;nom est requis.</span>
            </div>
        </div>
        <% } else { %>
        <div class="control-group">
            <label class="control-label" for="firstname">Pr&eacute;nom</label>
            <div class="controls">
                <input type="text" class="span3" name="firstname" <% if(customer.getFirstName() != null) { %> value="<%= customer.getFirstName() %>" <% } %> placeholder="Enter your firstname..." />
            </div>
        </div>
        <% } %>
        <% if ((errorMap != null && errorMap.get("lastName") != null && errorMap.get("lastName") == false)) { %>
        <div class="control-group error">
            <label class="control-label" for="lastname">Nom</label>
            <div class="controls">
                <input type="text" class="span3" name="lastname" <% if(customer.getLastName() != null) { %> value="<%= customer.getLastName() %>" <% } %> placeholder="Enter your lastname..."/>
                <span class="help-inline"><i class="icon-exclamation-sign"></i></span>
                <span class="help-block">Le nom est requis.</span>
            </div>
        </div>
        <% } else { %>
        <div class="control-group">
            <label class="control-label" for="lastname">Nom</label>
            <div class="controls">
                <input type="text" class="span3" name="lastname" <% if(customer.getLastName() != null) { %> value="<%= customer.getLastName() %>" <% } %> placeholder="Enter your lastname..."/>
            </div>
        </div>
        <% } %>
        <% if ((errorMap != null && errorMap.get("email") != null && errorMap.get("email") == false)) { %>
        <div class="control-group error">
            <label class="control-label" for="email">Adresse &eacute;lectronique</label>
            <div class="controls">
                <input type="email" class="span3" name="email" <% if(customer.getEmail() != null) { %> value="<%= customer.getEmail() %>" <% } %> placeholder="Enter your email address..."/>
                <span class="help-inline"><i class="icon-exclamation-sign"></i></span>
                <span class="help-block">Une adresse e-mail <strong>valide</strong> est requise.</span>
            </div>
        </div>
        <% } else { %>
        <div class="control-group">
            <label class="control-label" for="email">Adresse &eacute;lectronique</label>
            <div class="controls">
                <input type="email" class="span3" name="email" <% if(customer.getEmail() != null) { %> value="<%= customer.getEmail() %>" <% } %> placeholder="Enter your email address..."/>
            </div>
        </div>
        <% } %>
        <% if ((errorMap != null && errorMap.get("phoneNumber") != null && errorMap.get("phoneNumber") == false)) { %>
        <div class="control-group error">
            <label class="control-label" for="phonenumber">Num&eacute;ro de t&eacute;l&eacute;phone</label>
            <div class="controls">
                <input type="text"  class="span3" name="phonenumber" <% if(customer.getNumTel() != null) { %> value="<%= customer.getNumTel() %>" <% } %> placeholder="Enter your phone number..."/>
                <span class="help-inline"><i class="icon-exclamation-sign"></i></span>
                <span class="help-block">Un num&eacute;ro de t&eacute;l&eacute;phone <strong>valide</strong> est requis.</span>
            </div>
        </div>
        <% } else { %>
        <div class="control-group">
            <label class="control-label" for="phonenumber">Num&eacute;ro de t&eacute;l&eacute;phone</label>
            <div class="controls">
                <input type="text"  class="span3" name="phonenumber" <% if(customer.getNumTel() != null) { %> value="<%= customer.getNumTel() %>" <% } %> placeholder="Enter your phone number..."/>
            </div>
        </div>
        <% } %>
        <hr/>
        <div class="row-fluid">
            <div class="pull-left">
                <input type="submit" class="btn btn-danger" name="cancel" value="annuler"/>
            </div>
            <div class="pull-right">
                <input type="submit" class="btn btn-primary" name="next" value="adresse&nbsp;&rarr;"/>
            </div>
        </div>
    </form>
<% } %>
</div>

<%@include file="_right.jsp" %>
<%@include file="_footer.jsp" %>